package com.neutech.base;

import java.awt.Graphics;
import java.awt.Rectangle;

/**
 *
 * 精灵类，游戏内所有元素的基类
 *
 * */
public abstract class Sprite {
    private int x;
    private int y;
    private int width;
    private int height;
    public Sprite(){}
    public Sprite(int x,int y){
        this.x=x;
        this.y=y;
    }

    public Sprite(int x, int y, int width, int height) {
        this.x = x;
        this.y = y;
        this.width = width;
        this.height = height;
    }
    //方便子类移动的重写，形成三态
    public void move(){}
    //方便子类的绘画的重写
    public abstract void draw(Graphics g);
    public Rectangle createRectangle(){
        return new Rectangle();
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
}

